<?php
class user {
	public $username;
	public $password;
	// set get username
	public function setusername($username) {
		$this->username = $username;
	}
	public function getusername() {
		return $this->username;
	}
	// set get password
	public function setpassword($password) {
		$this->password = $password;
	}
	public function getpassword() {
		return $this->password;
	}
	// check login
	public function checklogin() {
		Global $db;
		$sql = "select * from " . $db->tbl_fix . "user where `username`='" . $this->username . "' AND `password` = '" . $this->password . "'";
		$rows = $db->executeQuery ( $sql, 2 );
		if (isset ( $rows ))
			return $rows;
	}
	public function updatelastlogin($userid) {
		Global $db;
		$sql = "update " . $db->tbl_fix . "user set `lastlogin`='" . date ( "d.m.Y", time () ) . " - " . $_SERVER ["REMOTE_ADDR"] . "' WHERE `user_id` = '" . $userid . "'";
		$db->executeQuery ( $sql );
	}
}
$user = new user ();
?>